/*
 * MainMenu_MainView.java
 * Final Project Example
 * Created on Oct 9, 2014, 02:16:42 PM
 * by Fairul Filza with Team FA_PemrogrammanLanjut
 */

package Views;

// <editor-fold defaultstate="collapsed" desc="Import Code">
import Controllers.MainMenu_Controller;
import Interfaces.ViewsProcess_Interface;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JPopupMenu.Separator;
import javax.swing.JTextField;
import javax.swing.Timer;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;
// </editor-fold>

/** @author PemrogrammanLanjut_LABIV_TI_05~09 */
public class MainMenu_MainView extends JFrame implements ViewsProcess_Interface {
    private MasterCd_View PanelMasterCd;
    private Transaction_EditView PanelTransaction;
    private Transaction_ListView PanelCdSales;
    private Category_View PanelCategory;
    private JLabel LblWallpaper;
    private JLabel LblStatus;
    private JLabel LblDate;
    private JLabel LblMonth;
    private JLabel LblTime;
    private JButton BtnMasterCd;
    private JButton BtnTransaction;
    private JButton BtnDvdSales;
    private JButton BtnCategory;
    private JButton BtnExit;
    private JPanel PnlFront;
//    private JPanel PnlTransaction;
    //private JPanel PnlMasterCd;
//    private JPanel PnlCdSales;
    private JTextField TxtSearch;
    private JButton BtnSearch;
    private Timer DateTimer;
    private ImageIcon Image;
    

    // <editor-fold defaultstate="collapsed" desc="Constructor Code">
    public MainMenu_MainView() {
        PnlFront = new JPanel();
        LblWallpaper = new JLabel();
        BtnMasterCd = new JButton();
        BtnTransaction = new JButton ();
        BtnDvdSales = new JButton ();
        BtnCategory = new JButton();
        BtnExit = new JButton ();
        TxtSearch = new JTextField ();
        BtnSearch = new JButton ();
        LblStatus = new JLabel();
        LblDate = new JLabel();
        LblMonth = new JLabel();
        LblTime = new JLabel();
//        PnlTransaction = new JPanel();
//        PnlMasterCd = new JPanel();
//        PnlCdSales = new JPanel();
        PanelMasterCd = new MasterCd_View(this);
        PanelTransaction = new Transaction_EditView();
        PanelCdSales = new Transaction_ListView();
        PanelCategory = new Category_View(this);
        initFrameProcess();
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Getter and Setter Code">
    public JPanel getPnlFront(){
        return PnlFront;
    }
    public void setPnlFront(JPanel PnlFront){
        this.PnlFront = PnlFront;
    }
//    public JPanel getPnlTransaction() {
//        return PnlTransaction;
//    }
//
//    public void setPnlTransaction(JPanel PnlTransaction) {
//        this.PnlTransaction = PnlTransaction;
//    }
//    public JPanel getPnlMasterCd() {
//        return PnlMasterCd;
//    }
//
//    public void setPnlMasterCd(JPanel PnlMasterCd) {
//        this.PnlMasterCd = PnlMasterCd;
//    }
//    public JPanel getPnlCdSales() {
//        return PnlCdSales;
//    }
//
//    public void setPnlCdSales(JPanel PnlCdSales) {
//        this.PnlCdSales = PnlCdSales;
//    }
    public JLabel getLblWallpaper (){
        return LblWallpaper;
    }
    public void setLblWallpaper(JLabel LblWallpaper){
        this.LblWallpaper = LblWallpaper;
    }
    
    public JButton getBtnMasterCd (){
        return BtnMasterCd;
    }
    public void setBtnMasterCd(JButton BtnMasterCd){
        this.BtnMasterCd = BtnMasterCd;
    }
    public JButton getBtnTransaction(){
        return BtnTransaction;
    }
    public void setBtnTransaction(JButton BtnTransaction){
        this.BtnTransaction = BtnTransaction;
    }
    public JButton getBtnDvdSales(){
        return BtnDvdSales;
    }
    public void setBtnDvdSales(JButton BtnDvdSales){
        this.BtnDvdSales = BtnDvdSales;
    }

    public JButton getBtnCategory() {
        return BtnCategory;
    }

    public void setBtnCategory(JButton BtnCategory) {
        this.BtnCategory = BtnCategory;
    }
    
     public JButton getBtnExit(){
        return BtnExit;
     }

    public void setBtnExit(JButton BtnExit){
        this.BtnExit = BtnExit;
    }
      public JTextField getTxtSearch(){
        return TxtSearch;
    }
    public void setTxtSearch(JTextField TxtSearch){
        this.TxtSearch = TxtSearch;
    }
    public JButton getBtnSearch(){
        return BtnSearch;
    }
    public void setBtnSearch(JButton BtnSearch){
        this.BtnSearch = BtnSearch;
    }

    public MasterCd_View getPanelMasterCd() {
        return PanelMasterCd;
    }

    public void setPanelMasterCd(MasterCd_View PanelMasterCd) {
        this.PanelMasterCd = PanelMasterCd;
    }

    public Transaction_EditView getPanelTransaction() {
        return PanelTransaction;
    }

    public void setPanelTransaction(Transaction_EditView PanelTransaction) {
        this.PanelTransaction = PanelTransaction;
    }

    public Transaction_ListView getPanelCdSales() {
        return PanelCdSales;
    }

    public void setPanelCdSales(Transaction_ListView PanelCdSales) {
        this.PanelCdSales = PanelCdSales;
    }

    public Category_View getPanelCategory() {
        return PanelCategory;
    }

    public void setPanelCategory(Category_View PanelCategory) {
        this.PanelCategory = PanelCategory;
    }

    public JLabel getLblStatus() {
        return LblStatus;
    }

    public void setLblStatus(JLabel LblStatus) {
        this.LblStatus = LblStatus;
    }
    public JLabel getLblDate() {
        return LblDate;
    }

    public void setLblDate(JLabel LblDate) {
        this.LblDate = LblDate;
    }

    public JLabel getLblMonth() {
        return LblMonth;
    }

    public void setLblMonth(JLabel LblMonth) {
        this.LblMonth = LblMonth;
    }

    public JLabel getLblTime() {
        return LblTime;
    }

    public void setLblTime(JLabel LblTime) {
        this.LblTime = LblTime;
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Method Code">
    private void initFrameProcess() {
        MainMenu_Controller ControlPanel = new MainMenu_Controller(this);

        initComponents();
        eventControllers();
        imageControllers();
    }

    @Override
    public void initComponents() {
        Font FontStyle = new Font("Tahoma", 1, 12);
        setTitle("DVD Application");
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        setResizable(false);
        getContentPane().setLayout(new AbsoluteLayout());
        getContentPane().add(PnlFront, new AbsoluteConstraints(0, 0, 1024, 576));

        PnlFront.setLayout(null);
        PnlFront.setBackground(new Color(0, 0, 0));
        PnlFront.setOpaque(true);

//        setPnlMasterCd(new JPanel());
        
        PanelMasterCd.setVisible(true);
  //      setPnlMasterCd(PanelMasterCd);
  //      PnlMasterCd.setVisible(true);
        PanelMasterCd.setBackground(new Color(0, 250, 0));
        PanelMasterCd.setOpaque(false);
        PnlFront.add(PanelMasterCd);
        PanelMasterCd.setBounds(0, 0, 1024, 576);
        
        
//        setPnlTransaction(new JPanel());
//        Transaction_EditView PanelTransaction = new Transaction_EditView();
//        setPnlTransaction(PanelTransaction.pnlEntities());
        PanelTransaction.setVisible(false);
        PanelTransaction.setBackground(new Color(0, 250, 0));
        PanelTransaction.setOpaque(false);
        PnlFront.add(getPanelTransaction());
        PanelTransaction.setBounds(0, 0, 1024, 576);
        
        PanelCdSales.setVisible(false);
        PanelCdSales.setBackground(new Color(0, 250, 0));
        PanelCdSales.setOpaque(false);
        PnlFront.add(getPanelCdSales());
        PanelCdSales.setBounds(0, 0, 1024, 576);
        
        PanelCategory.setVisible(false);
        PanelCategory.setBackground(new Color(0, 250, 0));
        PanelCategory.setOpaque(false);
        PnlFront.add(getPanelCategory());
        PanelCategory.setBounds(0, 0, 1024, 576);
        
        
        
        BtnExit.setOpaque(false);
        BtnExit.setBorderPainted(false);
        BtnExit.setContentAreaFilled(false);
        BtnExit.setBorder(null);
        BtnExit.setVisible(true);
        BtnExit.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnExit);
        BtnExit.setBounds(902,85,119,36);
        
        
        BtnMasterCd.setOpaque(false);
        BtnMasterCd.setBorderPainted(false);
        BtnMasterCd.setContentAreaFilled(false);
        BtnMasterCd.setBorder(null);
        BtnMasterCd.setVisible(true);
        BtnMasterCd.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnMasterCd);
        BtnMasterCd.setBounds(134,83,98,39);

        BtnTransaction.setOpaque(false);
        BtnTransaction.setBorderPainted(false);
        BtnTransaction.setContentAreaFilled(false);
        BtnTransaction.setBorder(null);
        BtnTransaction.setVisible(true);
        BtnTransaction.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnTransaction);
        BtnTransaction.setBounds(249,83,98,39);

        BtnDvdSales.setOpaque(false);
        BtnDvdSales.setBorderPainted(false);
        BtnDvdSales.setContentAreaFilled(false);
        BtnDvdSales.setBorder(null);
        BtnDvdSales.setVisible(true);
        BtnDvdSales.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnDvdSales);
        BtnDvdSales.setBounds(374,83,98,39);
        
        BtnCategory.setOpaque(false);
        BtnCategory.setBorderPainted(false);
        BtnCategory.setContentAreaFilled(false);
        BtnCategory.setBorder(null);
        BtnCategory.setVisible(true);
        BtnCategory.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnCategory);
        BtnCategory.setBounds(489,83,82,39);
        
        BtnSearch.setOpaque(false);
        BtnSearch.setBorderPainted(false);
        BtnSearch.setContentAreaFilled(false);
        BtnSearch.setBorder(null);
        BtnSearch.setVisible(true);
        BtnSearch.setCursor(new Cursor(Cursor.HAND_CURSOR));
        PnlFront.add(BtnSearch);
        BtnSearch.setBounds(854,90,26,25);

        TxtSearch.setOpaque(true);
        TxtSearch.setBorder(null);
        TxtSearch.setHorizontalAlignment(JLabel.LEADING);
        TxtSearch.setFont(FontStyle);
        PnlFront.add(TxtSearch);
        TxtSearch.setBounds(605,91,246,24);
        
        LblStatus.setText(null);
        LblStatus.setBackground(new Color(0, 0, 0));
        LblStatus.setOpaque(false);
        PnlFront.add(LblStatus);
        LblStatus.setBounds(140, 135, 72, 22);
        
        LblDate.setFont(new Font("Arial", (Font.BOLD | Font.ITALIC), 40));
        LblDate.setHorizontalAlignment(JLabel.CENTER);
        LblDate.setText(null);
        PnlFront.add(LblDate);
        LblDate.setBounds(6, 470, 118, 98);

        LblMonth.setFont(new Font("Arial", 1, 17));
        LblMonth.setHorizontalAlignment(JLabel.CENTER);
        LblMonth.setText(null);
        PnlFront.add(LblMonth);
        LblMonth.setBounds(0, 450, 130, 29);

        LblTime.setFont(new Font("Arial", 1, 45));
        LblTime.setHorizontalAlignment(JLabel.CENTER);
        LblTime.setText(null);
        PnlFront.add(LblTime);
        LblTime.setBounds(6, 385, 118, 50);
        
        LblWallpaper.setText(null);
        LblWallpaper.setBackground(new Color(250, 250, 0));
        LblWallpaper.setOpaque(true);
        PnlFront.add(LblWallpaper);
        LblWallpaper.setBounds(0, 0, 1024, 576);

        pack();
        this.setLocationRelativeTo(this);
    }

    @Override
    public void eventControllers() {
        MainMenu_Controller ControlPanel = new MainMenu_Controller(this);
        this.addWindowListener(ControlPanel.MainWindow_Listener);

        BtnExit.addActionListener(ControlPanel.MainButton_Listener);
        BtnExit.addMouseListener(ControlPanel.MainButtonImg_Listener);
        BtnMasterCd.addActionListener(ControlPanel.MainButton_Listener);
        BtnMasterCd.addMouseListener(ControlPanel.MainButtonImg_Listener);
        BtnTransaction.addActionListener(ControlPanel.MainButton_Listener);
        BtnTransaction.addMouseListener(ControlPanel.MainButtonImg_Listener);
        BtnDvdSales.addActionListener(ControlPanel.MainButton_Listener);
        BtnDvdSales.addMouseListener(ControlPanel.MainButtonImg_Listener);
        BtnCategory.addActionListener(ControlPanel.MainButton_Listener);
        BtnCategory.addMouseListener(ControlPanel.MainButtonImg_Listener);
        BtnSearch.addActionListener(ControlPanel.MainButton_Listener);
        BtnSearch.addMouseListener(ControlPanel.MainButtonImg_Listener);
        TxtSearch.addKeyListener(ControlPanel.MenuKey_Listener);
        DateTimer = new Timer(1000, ControlPanel.CurrentDate_ActListener);
        DateTimer.start();
    }

    @Override
    public void imageControllers() {
        Image = new ImageIcon(getClass().getResource("/Images/mastercd3.png"));
        LblWallpaper.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/katalogcd.png"));
        LblStatus.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/exit.png"));
        BtnExit.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/Mastercd_btn.png"));
        BtnMasterCd.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/Transaction_btn.png"));
        BtnTransaction.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/dvdsales_btn.png"));
        BtnDvdSales.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/category.png"));
        BtnCategory.setIcon(Image);
        Image = new ImageIcon(getClass().getResource("/Images/search.png"));
        BtnSearch.setIcon(Image);
                
    }
    // </editor-fold>
}
// End of Code